package com.un.ebs.product.dto;

import com.un.ebs.product.enums.*;
import lombok.Data;

import javax.validation.constraints.NotNull;
import javax.validation.constraints.Pattern;
import java.util.ArrayList;
import java.util.Date;
import java.util.List;

/**
 * <p>
 *  Add dto.
 * </p>
 *
 * @author liubo
 * @since 2019-09-16
 */
@Data
public class ProductDto  {

    private String id;

    @NotNull
    private String code;

    @NotNull
    private String name;

    @NotNull
    private String classId;

    private ProductUnitTypeEnum unitType;

    private ProductChargeTypeEnum chargeType = ProductChargeTypeEnum.BeforePay;

    private ProductPriceConfirmTypeEnum priceConfirmType = ProductPriceConfirmTypeEnum.Default;

    private ProductPurchaseTypeEnum purchaseType = ProductPurchaseTypeEnum.Default;

    private ProductSaleTypeEnum saleType = ProductSaleTypeEnum.Open;

    private Boolean isDeliverFlow;

    private Boolean isDeliverAuditStatus;

    private Boolean isMustDefunctByOrder;

    private Boolean isMustDefunctTombSkuByOrder;

    private String saleLargeClassId;

    private String saleMediumClassId;

    private String saleSmallClassId;

    /**
     * 最大购买量
     */
    private int buyMaxQty;

    /**
     * 最小购买量
     */
    private int buyMinQty;

    private Date saleStart;

    private Date saleEnd;

    /**
     * 交付准备时间，此时间用来提醒用户何时开始准备做订单商品交付准备。
     */
    @Pattern(regexp = "^\\d{1,2}(d|h|m)$", message = "数据格式不正确，请按以下格式填写：<br>1d：表示为1天；<br>1h：表示为1小时；<br>1m:表示为1分钟；<br>数字最大只能为99。")
    private String deliverReadyTime;

    private Date deliverStart;

    private Date deliverEnd;

    private Double chargeMinMoney = 0d;

    private Double price;

    private String warehouseDesc;

    private String remark;

    /**
     * 是否支持预约
     */
    private Boolean isBook;

    /**
     * 每时段可预约量，时段配置在品类定义中
     */
    private int preTimeBookQty;

    private List<ProductAttrValueDto> attrValues = new ArrayList<>();

    /**
     * 在更新商品时，如果需要删除某个属性值，则需要给定该值的id
     */
    private List<String> removeAttrValueIds = new ArrayList<>();
}